using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for FloorDetailDao
/// </summary>
public class FloorDetailDao
{
    public FloorDetailDao() { }

    public bool AddQuickPurchase(FloorDetail dto)
    {
        string proc = "sp_QuickPurchase";
        SqlCommand cmd = DbProvider.CreateCommand(proc);

        cmd.Parameters.Add("@ProID", SqlDbType.Decimal);
        cmd.Parameters.Add("@Buyer", SqlDbType.VarChar);
        cmd.Parameters.Add("@Bid", SqlDbType.Money);
        cmd.Parameters.Add("@BidDate", SqlDbType.DateTime);
        cmd.Parameters.Add("@rs", SqlDbType.Bit).Direction = ParameterDirection.Output;

        cmd.Parameters["@ProID"].Value = dto.ProID;
        cmd.Parameters["@Buyer"].Value = dto.Buyer;
        cmd.Parameters["@Bid"].Value = dto.Bid;
        cmd.Parameters["@BidDate"].Value = dto.BidDate;

        DbProvider.ExecCmd(cmd);
        return (bool)cmd.Parameters["@rs"].Value;
    }

    public int AddBid(FloorDetail dto)
    {
        string proc = "sp_Bid";
        SqlCommand cmd = DbProvider.CreateCommand(proc);

        cmd.Parameters.Add("@ProID", SqlDbType.Decimal);
        cmd.Parameters.Add("@Buyer", SqlDbType.VarChar);
        cmd.Parameters.Add("@Bid", SqlDbType.Money);
        cmd.Parameters.Add("@BidDate", SqlDbType.DateTime);
        cmd.Parameters.Add("@MaxBid", SqlDbType.Money);
        cmd.Parameters.Add("@rs", SqlDbType.Int).Direction = ParameterDirection.Output;

        cmd.Parameters["@ProID"].Value = dto.ProID;
        cmd.Parameters["@Buyer"].Value = dto.Buyer;
        cmd.Parameters["@Bid"].Value = dto.Bid;
        cmd.Parameters["@BidDate"].Value = dto.BidDate;
        cmd.Parameters["@MaxBid"].Value = dto.MaxBid;

        DbProvider.ExecCmd(cmd);
        return (int)cmd.Parameters["@rs"].Value;
    }
}
